<!--坐标点及文字-->
<template>
  <div>
    <FunctionlUnitFrame @closePane="closePane">
      <template slot="title">点</template>
      <template slot="content">
        <!--坐标点类型-->
        <table class="pointtypetable " :class="pointCategoryNum=='1'?'':'nodisplay'">
          <tr>
            <td :class="pointtypenum==1?'pointtypetableTdactive':''" @click="pointtypeTdC('txt',1)"><img src="../../assets/img/Plotting/label.jpg" height="63" width="60" /></td>
            <td :class="pointtypenum==2?'pointtypetableTdactive':''" @click="pointtypeTdC('img',2)"><img src="../../assets/img/Plotting/point.jpg" height="58" width="60" @click="drawPoint"/></td>
            <td :class="pointtypenum==3?'pointtypetableTdactive':''" @click="pointtypeTdC('img',3)"><img src="../../assets/img/Plotting/mark1.png" height="44" width="32"/></td>
          </tr>
          <tr>
            <td :class="pointtypenum==4?'pointtypetableTdactive':''" @click="pointtypeTdC('img',4)"><img src="../../assets/img/Plotting/mark2.png" height="44" width="32"/></td>
            <td :class="pointtypenum==5?'pointtypetableTdactive':''" @click="pointtypeTdC('img',5)"><img src="../../assets/img/Plotting/mark3.png" height="44" width="32"/></td>
            <td :class="pointtypenum==6?'pointtypetableTdactive':''" @click="pointtypeTdC('img',6)"><img src="../../assets/img/Plotting/mark4.png" height="44" width="32"/></td>
          </tr>
        </table>
        <!--坐标点坐标-->
        <table class="pointpointtable  " :class="pointCategoryNum=='2'?'':'nodisplay'">
          <tr>
            <th colspan="2">-坐标列表</th>
          </tr>
          <tr>
            <td>经度：</td>
            <td>
              <input value="115.56789"/>
            </td>
          </tr>
          <tr>
            <td>维度：</td>
            <td>
              <input value="31.5232"/>
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <el-button type="primary">定位</el-button>
            </td>
          </tr>
        </table>
        <!--图标坐标点样式-->
        <table class="pointcsstable " :class="pointCategoryNum+pointtype=='3img'?'':'nodisplay'">
          <tr>
            <th colspan="2">-样式信息</th>
          </tr>
          <tr>
            <td>类型</td><td>图标点标记</td>
          </tr>
          <tr>
            <td>图标</td><td>******</td>
          </tr>
          <tr>
            <td>透明度</td><td><el-slider v-model="pointOpacity" style="width: 80%"></el-slider></td>
          </tr>
          <tr>
            <td>大小比例</td><td>  <input value=""/>
          </td>
          </tr>
          <tr>
            <td>旋转角度</td><td><input value=""/>
          </td>
          </tr>
          <tr>
            <td>是否按规矩缩放</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch>
          </td>
          </tr>
          <tr>
            <td>是否按规矩显示</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch></td>
          </tr>
          <tr>
            <th colspan="2">-属性信息</th>
          <tr>
            <td>名称</td><td>
            <input value=""/>
          </td>
          </tr>
          <tr>
            <td>备注</td><td>
            <input value=""/></td>
          </tr>
        </table>
        <!--文字坐标点样式-->
        <table class="pointcsstable " :class="pointCategoryNum+pointtype=='3txt'?'':'nodisplay'">
          <tr>
            <th colspan="2">-样式信息</th>
          </tr>
          <tr>
            <td>类型</td><td>文字</td>
          </tr>
          <tr>
            <td>内容</td><td>
            <input/>
          </td>
          </tr>
          <tr>
            <td>颜色</td>
            <td>
              <colorPicker v-model="color" />
            </td>
          </tr>
          <tr>
            <td>透明度</td><td><el-slider v-model="pointOpacity" style="width: 80%"></el-slider></td>
          </tr>
          <tr>
            <td>字体大小</td><td>  <input value=""/>
          </td>
          </tr>
          <tr>
            <td>是否衬色</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch>
          </td>
          </tr>
          <tr>
            <td>衬色颜色</td>
            <td>
              <colorPicker v-model="color" />
            </td>
          </tr>
          <tr>
            <td>衬色宽度</td><td>
            <input/>
          </td>
          </tr>
          <tr>
            <td>是否背景</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch></td>
          </tr>
          <tr>
            <td>是否加粗</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch></td>
          </tr>
          <tr>
            <td>是否斜体</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch></td>
          </tr>
          <!--<tr>-->
            <!--<td>是否按规矩缩放</td><td>-->
            <!--<el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">-->
            <!--</el-switch></td>-->
          <!--</tr>-->
          <!--<tr>-->
            <!--<td>是否按规矩显示</td><td>-->
            <!--<el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">-->
            <!--</el-switch></td>-->
          <!--</tr>-->
          <tr>
            <th colspan="2">-属性信息</th>
          <tr>
            <td>名称</td><td>
            <input value=""/>
          </td>
          </tr>
          <tr>
            <td>备注</td><td>
            <input value=""/></td>
          </tr>
        </table>
        <!--图标tab-->
        <table class="pointCategory">
          <tr>
            <td @click="pointCategoryTdC(1) "  :class="pointCategoryNum=='1'?'active':''">类型</td>
            <td @click="pointCategoryTdC(2) " :class="pointCategoryNum=='2'?'active':''">坐标点</td>
            <td @click="pointCategoryTdC(3)" :class="pointCategoryNum=='3'?'active':''" >属性</td>
          </tr>
        </table>

      </template>
    </FunctionlUnitFrame>
  </div>
</template>

<script>
    import FunctionlUnitFrame from '@/components/FunctionalUnit/FunctionlUnitFrame'
    export default {
      name: "Point",
      data(){
        return {
          pointOpacity:100,
          switcVlaue:true,
          pointCategoryNum:'1',
          pointtype:'img',
          color: '#ff0000',
          pointtypenum:0
        }
      },
    components:{
      'FunctionlUnitFrame':FunctionlUnitFrame
    },
    methods:{
      closePane(){
        this.$emit('closePane',false);
      },
      pointtypeTdC(type,num){
        this.pointtype=type;
        this.pointtypenum=num;
      },
      pointCategoryTdC(num){
        this.pointCategoryNum=num;
      },
      /*画点*/
      drawPoint:function () {
        var _this = this.$parent.$parent;
        var Cesium = this.$parent.$parent.Cesium;
        var CesiumAPI = this.CesiumAPI;
        var handler = new Cesium.ScreenSpaceEventHandler(this.$parent.$parent.viewer.scene.canvas);
        //坐标存储
        var positions = [];
        //单击鼠标左键画点
        handler.setInputAction(function (movement) {
          var cartesian = _this.viewer.scene.camera.pickEllipsoid(movement.position, _this.viewer.scene.globe.ellipsoid);
          positions.push(cartesian);
          var point = {
            position: cartesian,
            point: {
              color: Cesium.Color.RED,
              pixelSize: 25,
              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
            }
          };
          CesiumAPI.CreateObj.createPoint('test',_this.viewer,point,function (item) {
            console.log(item);
          });
          handler.destroy();
        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
      },
    },

  }
</script>

<style scoped>
  .layerpanel{
    width: 320px;
    height: 850px;
    top: 30px;
  }
  .m-colorPicker {
    position: relative;
    text-align: left;
    font-size: 14px;
    display: inline-block;
    z-index: 99;
  }
  table tr td{
    height: 45px;
    font-size: 10px;
    padding-left: 15px;
  }
  table tr td input {
    height: 38px;
    background-color:  rgba(45,52,68,.5);
    border: 1px solid rgba(237, 255, 255,1);
  }
  table tr th{
    height: 30px;
    font-size: 12px;
    font-weight: bold;
    font-family: Arial;
    cursor: pointer;
    text-align: left;
    background-color: rgba(28, 59, 58,.6);
  }
  table tr td:first-child{
    width: 40%;
  }
  table tr td:nth-child(2){
    width: 60%;
  }
  /********点类型样式*********/
  .pointtypetable{
    width: 100%;
    border-collapse: separate;
    border-spacing:18px;
  }
  .pointtypetable tr td{
    padding-left: 0px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid white;
    width: 33.33%!important;
    cursor: pointer;
    height: 70px;
  }
  .pointtypetable tr td:hover{
    border: 1px solid blue;
  }
  .pointtypetableTdactive{
    border: 1px solid blue !important;
  }
  .nodisplay{
    display: none;
  }
  /***********点坐点定位************/
  .pointpointtable{
    width: 100%;
    border-collapse: collapse;
  }
  .pointpointtable tr th,td{
    vertical-align: middle;
    text-align: left;
    cursor: pointer;
  }
  .pointpointtable tr td{
    border: 1px solid rgba(237, 255, 255,1);
  }

  table tr td:nth-child(2) input:focus{
    border: .5px solid blue;
  }
  .pointpointtable tr:last-child td{
    height: 100px;
    border: none;
    text-align: center;
  }
  /***********点样式*****************/
  .pointcsstable{
    width: 100%;
    border-collapse: collapse;
  }
  .pointcsstable tr td{
    text-align: left;
    border: 1px solid rgba(237, 255, 255,1);
  }
  /***********点tab*******************/
  .pointCategory{
    /*width: 100%;*/
    height: 40px;
    position: fixed;
    bottom: 0px;
    border-collapse: separate;
    border-spacing: 6px;
  }
  .pointCategory tr td{
    height: 40px;
    width: 60px !important;
    color: #dff0d8;
    cursor: pointer;
    border: 1px solid rgba(45,52,68,1);
    text-align: center;
    padding-left: 0px;
  }

  .pointCategory .nodisplay{
    display: none;
  }
  .pointCategory tr td:hover{
    border: 1px solid  gray;
  }
  .active{
    border: 1px solid  gray !important;
  }

  @media screen and (max-width: 500px) {
    .layerpanel{
      width: 200px;
      height: 580px;
      top: 60px !important;
    }
    table tr td img{
      width: 50px;
      height: 50px;
    }

    table tr td{
      height: 25px;
      font-size: 10px;
      padding-left: 5px;
    }
    table tr td input {
      height: 20px;
    }
    /********点类型样式*********/
    .pointtypetable{
      width: 100%;
      border-collapse: separate;
      border-spacing:3px;
    }
    .pointpointtable tr td{
      padding-left: 0px;
      border: 1px solid rgba(237, 255, 255,1);
    }
    /***********点tab*******************/
    .pointCategory{
      /*width: 100%;*/
      height: 20px;
      position: fixed;
      bottom: 0px;
      border-collapse: separate;
      border-spacing: 3px;
    }
    .pointCategory tr td{
      padding-left: 0px !important;
      height: 20px;
      width: 40px !important;
      font-size: 12px;
      color: #dff0d8;
      cursor: pointer;
      border: 1px solid rgba(45,52,68,1);
      text-align: center;
    }
  }
</style>
